<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Extract information from result</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ldap-parse-result" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ldap_parse_result</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ldap_parse_result</span> &mdash; <span class="dc-title">Extract information from result</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.ldap-parse-result-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ldap_parse_result</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link</code></span>
   , <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$errcode</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$matcheddn</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$errmsg</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$referrals</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter reference">&$serverctrls</code></span>
  ]]]] ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Parses an LDAP search result.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ldap-parse-result-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">link</code></dt>

     <dd>

      <p class="para">
       An LDAP link identifier, returned by <span class="function"><a href="ldap_connect.html" class="function">ldap_connect()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">result_identifier</code></dt>

     <dd>

      <p class="para">
       An LDAP result resource, returned by <span class="function"><a href="ldap_list.html" class="function">ldap_list()</a></span> or
       <span class="function"><a href="ldap_search.html" class="function">ldap_search()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">errcode</code></dt>

     <dd>

      <p class="para">
       A reference to a variable that will be set to the LDAP error code in
       the result, or <em>0</em> if no error occurred.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">matcheddn</code></dt>

     <dd>

      <p class="para">
       A reference to a variable that will be set to a matched DN if one was
       recognised within the request, otherwise it will be set to <strong><code>NULL</code></strong>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">errmsg</code></dt>

     <dd>

      <p class="para">
       A reference to a variable that will be set to the LDAP error message in
       the result, or an empty string if no error occurred.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">referrals</code></dt>

     <dd>

      <p class="para">
       A reference to a variable that will be set to an <span class="type"><a href="language.types.array.html" class="type array">array</a></span> set
       to all of the referral strings in the result, or an empty array if no
       referrals were returned.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">serverctrls</code></dt>

     <dd>

      <p class="para">
       An <span class="type"><a href="language.types.array.html" class="type array">array</a></span> of LDAP Controls which have been sent with the response.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ldap-parse-result-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.ldap-parse-result-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>7.3</td>
       <td>
        Support for <code class="parameter">serverctrls</code> added
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ldap-parse-result-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5408">
    <p><strong>Example #1 <span class="function"><strong>ldap_parse_result()</strong></span> example</strong></p>
    <div class="example-contents">
     <div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ldap_search</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"cn=userref,dc=my-domain,dc=com"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"(cn=user*)"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$errcode&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$dn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$errmsg&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$refs&nbsp;</span><span style="color: #007700">=&nbsp;&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">;<br />if&nbsp;(</span><span style="color: #0000BB">ldap_parse_result</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$errcode</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$dn</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$errmsg</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$refs</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;do&nbsp;something&nbsp;with&nbsp;$errcode,&nbsp;$dn,&nbsp;$errmsg&nbsp;and&nbsp;$refs<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


</div></div></div></body></html>